﻿<script type="text/javascript">
    $(function () {
        $("button.modalLoder").live("click", function () {
            var url = $(this).data("url");            
            var data = getLoaderData($(this));
            var modal = $(this).data("link-modal");
            $.ajax({
                url: url,
                global: false,
                type: "GET",
                data:data,
                dataType: "html",
                success: function (data) {
                    $("#" + modal).html(data);
                    $("#" + modal).modal("show");
                }
            });
            return false;
        });

        function getLoaderData($this) {
            var url = $this.data("url");
            var num = $this.attr("data-num");
            var idInput = $this.data("link-id");
            var linkbtn = $this.attr("id");
            var nameInput = $this.data("link-name");
            var searchData = $this.attr("data-search") != undefined ? $this.attr("data-search") : "";
            var data = "url=" + url + "&" + "num=" + num + "&" + "linkbtn=" + linkbtn + "&" + "idInput=" + idInput + "&" + "nameInput=" + nameInput + "&" + searchData;
            return data;
        }
    });
</script>
